package system_smtp_service

import (
	"gitee.com/Luna-CY/Golang-Project-Template/internal/context"
	"gitee.com/Luna-CY/Golang-Project-Template/internal/errors"
	"gitee.com/Luna-CY/Golang-Project-Template/internal/interface/dao"
	"gitee.com/Luna-CY/Golang-Project-Template/model"
)

func (cls *Smtp) BatchGetSmtpLogAttachment(ctx context.Context, log *model.SystemSmtpLog) ([]*model.SystemSmtpLogAttachment, errors.Error) {
	if nil == log {
		return nil, nil
	}

	data, err := cls.smtpLogAttachment.BatchTakeSystemSmtpLogAttachmentByCondition(ctx, dao.SystemSmtpLogAttachmentOptionWithSmtpLogId(log.Id))
	if nil != err {
		return nil, err.Relation(errors.ErrorServerInternalError("ISS_TP.S_TP.BGSLA_NT.162350", "批量获取邮件日志附件失败"))
	}

	return data, nil
}
